//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Resource Application Block
//===============================================================================

using System;
using System.ComponentModel;
using EntLibContrib.Resource.Properties;

namespace EntLibContrib.Resource.Configuration.Design
{
	/// <summary>
	/// Represents a localized <see cref="CategoryAttribute"/>.
	/// </summary>
	[AttributeUsage(AttributeTargets.All)]
	public sealed class ResourceCategoryAttribute : CategoryAttribute
	{
		#region Construction
		/// <summary>
		/// Initialize a new instance of the <see cref="ResourceCategoryAttribute"/> class with the <see cref="Type"/> containing the resources and the resource name.
		/// </summary>
		/// <param name="category">The resources string name.</param>
		public ResourceCategoryAttribute (string category)
			: base(category)
		{
		}
		#endregion

		#region Protected Methods
		/// <summary>
		/// Gets the localized string based on the value.
		/// </summary>
		/// <param name="value">The identifer for the category to look up.</param>
		/// <returns>The localized string.</returns>
		protected override string GetLocalizedString (string value)
		{
			return InternalResources.ResourceManager.GetString(value, InternalResources.Culture);
		}
		#endregion
	}
}